﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/LOSSite.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<DataAccessLayer.Models.Product>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Content" runat="server">
    <script src="<%= Url.Content("~/Scripts/MicrosoftAjax.js") %>" type="text/javascript"></script>
    <script src="<%= Url.Content("~/Scripts/MicrosoftMvcAjax.js") %>" type="text/javascript"></script>
    <script src="<%= Url.Content("~/Scripts/MicrosoftMvcValidation.js") %>" type="text/javascript"></script>
    <h2>
        Product List</h2>
    <table>
        <% foreach (var item in Model)
           { %>
        <tr>
            <td>
                 <%= Html.ActionLink(item.ProductName, "Index", "Product", new { id = item.ProductId }, null)%>
            </td>
        </tr>
        <% } %>

        <tr>
            <td>
                <% if ( ViewData["Product"] != null )
                   {
                        if(ViewData["Product"] is DataAccessLayer.Models.HousingLoan)
                        { 
                            Html.RenderPartial("_FacilityHousingLoan", new DataAccessLayer.Models.FacilityHousingLoan()); 
                        }
                        else if (ViewData["Product"] is DataAccessLayer.Models.OverDraft)
                        {
                            Html.RenderPartial("_FacilityOverDraft", new DataAccessLayer.Models.FacilityOverDraft());
                        }
                        else if (ViewData["Product"] is DataAccessLayer.Models.TermLoan)
                        {
                            Html.RenderPartial("_FacilityTermLoan", new DataAccessLayer.Models.FacilityTermLoan());
                        } 
                   }
                %>
            </td>
        </tr>
    </table>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Greeting" runat="server">
    <% Html.RenderPartial("Greeting", Session["LoggedUser"]); %>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="MenuList" runat="server">
    <% Html.RenderPartial("MenuList", Session["LoggedUser"]); %>
</asp:Content>
